package com.demo.no1springboot.config;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledConfig {
    private final static Logger logger = LoggerFactory.getLogger(ScheduledConfig.class);


    @Scheduled(cron="0/2 * * * * ?")// cron 触发器 定义执行时间   ScheduledConfig 就是调度器   scheduledMethod 执行体
    public void scheduledMethod(){
        logger.info("ScheduledConfig:{}","定时任务");
        ////todo
    }
}
